package com.health.article.sever.controller;

import com.health.article.common.domain.dto.ShmArticleDTO;
import com.health.article.sever.service.ArticleService;
import com.health.common.core.domain.Result;
import com.health.common.core.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("article")
public class ArticleController extends BaseController {

    @Autowired
    private ArticleService articleService;

    @GetMapping("selectArticleAll")
    public Result selectArticleAll(){
        return Result.success(articleService.selectArticleAll());
    }

    @PostMapping("/authoringArticles")
    public Result authoringArticles(@RequestBody ShmArticleDTO shmArticleDTO){
        articleService.insertArticle(shmArticleDTO);
        return Result.success();
    }

    @GetMapping("/selectMyDraftAndArticle/{articleStatus}")
    public Result selectMyDraftAndArticle(@PathVariable Long articleStatus){
        return Result.success(articleService.selectMyDraftAndArticle(articleStatus));
    }

}
